/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package it.polimi.registration.gui.security;

/**
 *
 * @author Luca
 */

import it.polimi.registration.business.security.boundary.EventManager;
import it.polimi.registration.business.security.boundary.UsersManager;
import it.polimi.registration.business.security.entity.Event;
import java.io.Serializable;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.ViewScoped;


@ManagedBean
@RequestScoped
public class CarouselView implements Serializable {
    
    private List<Event> events;
    
    private Event selectedEvent;
    @EJB
    private EventManager evm;
    @EJB
    private UsersManager um;
    
    //@ManagedProperty("org.primefaces.showcase.service.CarService@3c3585")
    //private CarService service;
    
    @PostConstruct
    public void init() {
             events = evm.loadInvitations(um.getLoggedUsers());
    }

    public List<Event> getCars() {
        return getEvents();
    }

    public void setInvitation(Event event) {
        
    }

    public Event getSelectedCar() {
        return selectedEvent;
    }

    public void setSelectedCar(Event selectedEvent) {
        this.selectedEvent = selectedEvent;
    }
    
    
    public void loadInvitations() {
        events = evm.loadInvitations(um.getLoggedUsers());
    }

    /**
     * @return the events
     */
    public List<Event> getEvents() {
        return events;
    }

    /**
     * @param events the events to set
     */
    public void setEvents(List<Event> events) {
        this.events = events;
    }
}